﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WpfClient.Views;

namespace WpfClient
{
    public class Settings
    {
       

        public string Username
        {
            get 
            {
                //if (Properties.Settings.Default.login == "no")
                //{
                //    var settingsWin = new SettingsWindow();
                //    settingsWin.ShowDialog();
                //}

                if (Properties.Settings.Default.login == "no")
                {
                    return null;
                }
                else
                {
                    return Properties.Settings.Default.login;
                }
            }
            set 
            {
                if (string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value))
                {
                    return;
                }

                Properties.Settings.Default.login = value;
                Properties.Settings.Default.Save();
            }
        }


        public string Password 
        {
            get
            {
                //if (Properties.Settings.Default.pass == "no")
                //{
                //    var settingsWin = new SettingsWindow();
                //    settingsWin.ShowDialog();
                //}

                if (Properties.Settings.Default.pass == "no")
                {
                    return null;
                }
                else
                {
                    return Properties.Settings.Default.pass;
                }
            }
            set
            {
                if (string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value))
                {
                    return;
                }

                Properties.Settings.Default.pass = value;
                Properties.Settings.Default.Save();
            }
        
        
        }

        public bool UseRussian
        { 
            get 
            {
                return Properties.Settings.Default.useRussian;
            }
            set 
            {
                Properties.Settings.Default.useRussian = value;
                Properties.Settings.Default.Save();
            } 
        }

    }
}
